package com.lb.lambda;

import org.junit.Test;

import java.util.Comparator;

/**
 * @ClassName LambdaDemo
 * @Author hp
 * @Date 2021/6/9 21:54
 * @Version 1.0
 **/
public class LambdaDemo {
    @Test
    public void test1(){
        Runnable r1 = new Runnable() {
            @Override
            public void run() {
                System.out.println("hhh");
            }
        };
        r1.run();

        Runnable r2 = () -> System.out.println("sddsfdfssdf");
        r2.run();
    }

    @Test
    public void test2(){
        Comparator<Integer> com1 = new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                return 0;
            }
        };
        Comparator<Integer> com2 = Integer::compare;
        System.out.println(com2.compare(15,46));
    }
}
